import java.text.DecimalFormat;
import java.util.* ;
abstract class Person implements Comparable<Person>{
	private String name ;
	private int age ;
	private boolean gender ;
	public Person(String name , int age , boolean gender){
		this.name = name ;
		this.age = age ;
		this.gender = gender ;
	}
	public String toString() {
		return this.name + "-"+ this.age + "-"+ this.gender ;
	}
	public boolean equals(Person person){
		if((this.name != null)&& (person.name == null))
			return false ;
		if((this.age == person.age)&&(this.gender == person.gender)&&(this.name.equals(person.name)))
			return true ;
		return false ;
	}
	public int compareTo(Person person){
		if(this.name.equals(person.name))
			return this.age - person.age ;
		return this.name.compareTo(person.name) ;
	}
}
class Student extends Person{
	private String stuNo ;
	private String clazz ;
	public Student(String name, int age, boolean gender, String stuNo, String clazz){
		super(name,age,gender) ;
		this.stuNo = stuNo ;
		this.clazz = clazz ;
	}
	public String toString() {
		return "Student:"+ super.toString() + "-" + this.stuNo + "-" + this.clazz ;
		//+super.toString() + "-" + this.company + "-" +this.salary;
	}
	public boolean equals(Student student){
		if(!super.equals(student))
			return false ;
		if(this.clazz != null && student.clazz != null)
		{
			if(this.stuNo.equals(student.stuNo)&&this.clazz.equals(student.clazz))
				return true ;
			else 
				return false ;
		}
		else if(this.clazz == null && student.clazz == null)
		{
			if(this.stuNo.equals(student.stuNo))
				return true ;
			return false ;
		}
		else
			return false ;
	}
}
class Company{
	private String name ;
	public Company(String name){
		this.name = name ;
	}
	public String toString() {
		return this.name;
	}
	public boolean equals(Company company){
		if((this.name != null)&& (company.name == null))
			return false ;
		if(this.name.equals(company.name))
			return true ;
		return false ;
	}
}
class Employee extends Person{
	Company company ;
	double salary ;
	public Employee(String name, int age, boolean gender, double salary, Company company)
	{
		super(name,age,gender) ;
		this.company = company ;
		this.salary = salary ;
	}
	public String toString() {
		return "Employee:"+super.toString() + "-" + this.company + "-" +this.salary;
	}
	public boolean equals(Employee emp){
		if(super.equals(emp))
		{
			if((this.company != null)&& (emp.company == null))
				return false ;
			if(this.company.equals(emp.company)){
				DecimalFormat df = new DecimalFormat("#.#");
				if(df.format(this.salary) == df.format(emp.salary))
					return true ;
				return false ;
			}
			return false ;
		}
		return false ;
	}
}
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in) ;
		List<Person> personList = new ArrayList<Person>() ;
		List<Student> stuList = new ArrayList<Student>() ;
		List<Employee> empList = new ArrayList<Employee>() ;
		String choose = sc.next() ;
		while("s".equals(choose) || "e".equals(choose))
		{
			switch(choose)
			{
				case "s" :
					personList.add(new Student(sc.next(),sc.nextInt(),sc.nextBoolean(),sc.next(),sc.next()));
					choose = sc.next() ;
					break ;
				case "e" :
					personList.add(new Employee(sc.next(),sc.nextInt(),sc.nextBoolean(),sc.nextDouble(),new Company(sc.next())));
					choose = sc.next() ;
					break ;
			}
		}
		Collections.sort(personList);
		for (int i = 0; i < personList.size(); i++) {
			System.out.println(personList.get(i).toString()) ;
		}
		String ch = sc.next() ;
		if("exit".equals(ch))
			return ;
		for (int i = 0; i < personList.size(); i++) {
			if(personList.get(i) instanceof Student == true)
			{
				if(stuList.contains((Student)personList.get(i)))
					continue ;
				stuList.add((Student) personList.get(i)) ;
			}
			if(personList.get(i) instanceof Employee == true)
			{
				if(empList.contains((Employee)personList.get(i)))
					continue ;
				empList.add((Employee)personList.get(i)) ;
			}
		}
		System.out.println("stuList");
		for (int i = 0; i < stuList.size(); i++) {
			System.out.println(stuList.get(i));
		}
		System.out.println("empList");
		for (int i = 0; i < empList.size(); i++) {
			System.out.println(empList.get(i));
		}
	}
}